import request from '@/utils/request'

// 取消单个超时订单
export const cancelOrder = params => {
    return request({
        method: 'POST',
        url: '/order/cancelOrder',
        params
    })
}

// 自动取消超时订单
export const cancelTimeOutOrder = () => {
  return request({
      method: 'POST',
      url: '/order/cancelTimeOutOrder'
  })
}

// 用户取消订单
export const cancelUserOrder = params => {
  return request({
      method: 'POST',
      url: '/order/cancelUserOrder',
      params
  })
}

// 用户确认收货
export const confirmReceiveOrder = params => {
  return request({
      method: 'POST',
      url: '/order/confirmReceiveOrder',
      params
  })
}

// 用户删除订单
export const deleteOrder = params=> {
  return request({
      method: 'POST',
      url: '/order/deleteOrder',
      params
  })
} 


// 根据ID获取订单详情
export const getOrderInfo = orderId => {
  return request({
      method: 'GET',
      url: `/order/detail/${orderId}`
  })
} 

// 按状态分页获取用户订单列表
export const getOrderList = params => {
  return request({
      method: 'GET',
      params,
      url: `/order/list`
  })
} 

// 获取售后原因
export const getServiceReason = ()=>{
  return request({
    method: 'GET',
    params:{
      pageNum:1,
      pageSize:20
    },
    url: `/returnReason/list`
})
}